<?php
	require_once 'base.dao.php';
	require_once 'news_vao.php';
	
	class News_manager extends Base{
		
		public function __construct($conn){
			parent::__construct($conn);		
		}
		
		public function getNews(){
			$sql = sprintf("select * from NEWS order by news_date desc");	
						   					
			$result = mysql_query($sql,$this->conn);
	    	if(!$result){
	    		throw new Exception('It could not proceed your request to the Data Base.');
	    	}
	    	
	    	$return = array();
	    	
	    	while($row = mysql_fetch_array($result)){
	    		extract($row);
	    		$news = new News($ID_NEW,
	    						 $ID_SECTION,
	    						 $NEWS_DATE,
	    						 $DESCRIPTION_SHORT,
	    						 $DESCRIPTION_LONG);
	    		$return[] = $news;
	    	}
	    		    	
	    	return $return;
		}
	}
?>